from selenium import webdriver
import time


def main_2():
	url = "https://gitee.com/login"
	ChromeDriverPath = "/home/nc/download/google/chromedriver"
	driver = webdriver.Chrome(executable_path=ChromeDriverPath)
	driver.get(url)

	driver.find_element_by_id("user_login").send_keys("****")

	driver.find_element_by_id("user_password").send_keys("****")

	driver.find_element_by_css_selector("input[name='commit']").click()


	time.sleep(20)
	driver.close()#浏览器可以同时打开多个界面，close只关闭当前界面，不退出浏览器


def main():
	url = "https://leetcode-cn.com/"
	ChromeDriverPath = "/home/nc/download/google/chromedriver"
	driver = webdriver.Chrome(executable_path=ChromeDriverPath)
	driver.get(url)
	
	if driver.find_element_by_css_selector("[data-cypress='sign-in-with-password']").is_displayed():
		print("yes")

	# 切换到账号密码登录
	driver.find_element_by_css_selector("[data-cypress='sign-in-with-password']").click()

	# driver.find_element_by_name("login").send_keys("****")

	# driver.find_element_by_name("password").send_keys("****")

	# if driver.find_element_by_css_selector("button[type='submit']").is_displayed():
	# 	print("yes2")
	
	# driver.find_element_by_css_selector("button[type='submit']").click()
	# print("come in")


	time.sleep(20)
	driver.close()#浏览器可以同时打开多个界面，close只关闭当前界面，不退出浏览器
	driver.quit()#退出整个浏览器


if __name__ == "__main__":
	main_2()
